package com.jielihaofeng.nio.c4;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;

/**
 * @description 客户端
 * @author Johnnie Wind
 * @date 2021/10/11 22:17
 */
public class Client {

    public static void main(String[] args) throws IOException {
        SocketChannel sc = SocketChannel.open();
        sc.connect(new InetSocketAddress("localhost", 8080));
//        sc.write(Charset.defaultCharset().encode("hello\nworld\n")); //
        sc.write(Charset.defaultCharset().encode("0123456789abcdef666666\n")); //
//        System.out.println("waiting...");
        System.in.read();
    }

}
